﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Dishes.aspx.cs" Inherits="BuXiaChu.OrderDishes.Web.Admin.Restaurant.Dishes" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register TagPrefix="Menu" TagName="Header" Src="~/Modules/Menu/Header.ascx" %>
<%@ Register TagPrefix="Menu" TagName="Footer" Src="~/Modules/Menu/Footer.ascx" %>
<%@ Register TagPrefix="Menu" TagName="CityLeft" Src="~/Modules/Menu/CityLeft.ascx" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link media="screen, projection" rel="stylesheet" type="text/css" href="/css/Blueprint/screen.css" />
    <link media="screen, projection" rel="stylesheet" type="text/css" href="/css/main.css" />

    <script type="text/javascript" src="../js/Extend.js"></script>

    <script type="text/javascript" src="../js/Common.js"></script>

    <script type="text/javascript" src="../js/jquery-vsdoc.js"></script>

</head>
<body>
    <div class="container">
        <Menu:Header ID="Header1" runat="server" />
        <form id="form1" runat="server">
        <Menu:CityLeft ID="menu_CityLeft" runat="server" />
        <div class="span-20 last">
            <div class="boxc">
                <a href="Index.aspx">返回餐厅管理</a> <span>|</span> <a href="AddDishesCat.aspx?restaurantId=<%= Request.QueryString["restaurantId"] %>&restaurantName=<%= Request.QueryString["restaurantName"] %>">
                    菜品类别管理</a> <span>|</span> <a href="AddDishes.aspx?restaurantId=<%= Request.QueryString["restaurantId"] %>&restaurantName=<%= Request.QueryString["restaurantName"] %>">
                        增加菜品</a>
            </div>
            <div class="boxc">
                <span>菜品名称</span>
                <input type="text" id="txt_Name" />
                <input type="button" value="搜索" id="btn_Search" />
            </div>
            <div class="boxc">
                <div id="div_List">
                    加载中...
                </div>
            </div>
        </div>
        </form>
        <Menu:Footer ID="Footer1" runat="server" />
    </div>
</body>
</html>

<script type="text/javascript">
    function searchDishes(index, size) {
        var postData = {};
        postData.name = jDoc("txt_Name").value;
        postData.restaurantId = <%= Request.QueryString["restaurantId"] %>;
        postData.pageIndex = index == undefined ? 1 : index;
        postData.pageSize = size == undefined ? 20 : size;
        postData.t="1";
        $.post("Dishes.ashx", postData
            , function(data) {
                jDoc("div_List").innerHTML = data.message;
            }, "json");
    }
    function deleteDishes(id){
            if (confirm("确认删除吗？")) {
            $.post("Dishes.ashx",
            { id: id, t: 4 },
            function(data) {
                if (data.success) {    
                    jDoc.reload();                
                    alert("操作成功");
                } else {
                    alert("操作失败");
                }
            }, "json");
    }
    }
    searchDishes();
    jDoc.addEventHandler(jDoc("btn_Search"), "click", function() {
        searchDishes();
    })
    
</script>

